import request from '@/utils/request';
import type { IOrder, IWechatOrder } from '@/typings/interface';
import type { IPageRequest, OrderState } from '@/typings/api';

/**
 * 获取全部订单
 */
export function getOrders(req: IPageRequest & { state: OrderState | null }) {
  return request<IOrder, true>('/order/v1/list', {
    method: 'POST',
    data: req,
  });
}

/**
 * 微信支付
 */
export function wxPay(req: { id: number; type: string }) {
  return request<IWechatOrder>('/order/v1/pay', {
    method: 'POST',
    data: req,
  });
}